History for Top Level Document
??changed:
-
Issue:
Is there a need for a top level Document for all objects to reference as thier ownerDocument?
Notes:
Mike -- Further investigation shows a class called Root defined in ZDOM.py. This class is a base class for the Application.
Jim -- Which is wrong, as Amos has pointed out to us
several times. Sigh.
Of course, this doen't really have anything to do with
*whether* there should be a top-level document.
Mike -- Having a Document as the "Parent" class will not work well in Zope. A document is only allowed one element child, the document element. what we really neeed to say is that the application is trhe document element.
Jim -- Right.
Resolution:
Jim -- You need to tell us whether Zope needs to have a
top-level Document.
If the answer is yes, then it should be provided as a
sub-object defined in (a base class of) the Aplication
class. Something like:
In ZDOM.py or some such::
class ZopeDocument(Acquisition.Implicit, ...):
"""Implement the document interface
For the document that is Zope. :)
"""
# Note that we get at our top-level element
# and the rest of the object system though
# aq_parent, which we get because we acquire.
...
class ZopeTopLevelElement(...):
OwnerDocument=ZopeDocument()
....
In Application.py::
class Application(..., ZDOM.ZopeTopLevelElement, ...):
...
Mike -- This is the way I have implemented it. A super class of element called RootElement is a base class for application. The root element needs to be a special case, not for owner document support, but because it is the acuisition parent of all other nodes hence its parentNode attribute functions differently. I create a singleton Document for the Application when it is first created.
Jim -- The singleton should be defined in the class.
There's no reason to store it in the application
object.
Mike -- It is not. It is defined in RootElement.py as a singleton.